package com.segersten.othello.service.akka.lobby;

import java.util.Date;

public class Ticket {
	
	private Long created;
	private DomainPlayer player;

	public Ticket() {
	}

	public Ticket(DomainPlayer player) {
		created = new Date().getTime();
		this.player = player;
	}

	public Long getCreated() {
		return created;
	}

	public void setCreated(Long created) {
		this.created = created;
	}

	public DomainPlayer getDomainPlayer() {
		return player;
	}

	public void setDomainPlayer(DomainPlayer player) {
		this.player = player;
	}

	@Override
	public String toString() {
		return "Ticket [created=" + created + ", player=" + player + "]";
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((player == null) ? 0 : player.hashCode());
		result = prime * result + ((created == null) ? 0 : created.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Ticket other = (Ticket) obj;
		if (player == null) {
			if (other.player != null)
				return false;
		} else if (!player.equals(other.player))
			return false;
		if (created == null) {
			if (other.created != null)
				return false;
		} else if (!created.equals(other.created))
			return false;
		return true;
	}
	
	
	
}
